#pragma once

#include <vex/policy/protect_policy.h>
#include <vex/policy/empty_base.h>
#include <boost/operators.hpp>

namespace vex { namespace policy {
    template<class TClass, class TClassTraits, class TBase = vex::policy::empty_base>
    class totally_ordered 
        : public boost::totally_ordered1< totally_ordered<TClass, TClassTraits, TBase >, TBase >
    {

        friend bool operator < (totally_ordered const & p_l, totally_ordered const & p_r)
        {
            return static_cast<TClass const &>(p_l).get() < static_cast<TClass const &>(p_r).get();
        }

        friend bool operator == (totally_ordered const & p_l, totally_ordered const & p_r)
        {
            return static_cast<TClass const &>(p_l).get() == static_cast<TClass const &>(p_r).get();
        }

        //friend bool operator < (TClass const & p_l, TClass const & p_r)
        //{
        //    return static_cast<TClass const &>(p_l).get() < static_cast<TClass const &>(p_r).get();
        //}

        //friend bool operator == (TClass const & p_l, TClass const & p_r)
        //{
        //    return static_cast<TClass const &>(p_l).get() == static_cast<TClass const &>(p_r).get();
        //}

        VEX_PROTECT_POLICY(totally_ordered);
    };
}}